package com.kaibes.module.user.safe;

import java.time.LocalDateTime;

import javax.validation.constraints.Email;

import com.kaibes.core.base.annotation.Description;
import com.kaibes.core.validator.RegexButNull;
import com.kaibes.core.validator.ValidatorConsts;

import lombok.Data;

/**
CREATE TABLE `user_safe` (
  `id` integer NOT NULL AUTO_INCREMENT,
  `user_id` integer DEFAULT NULL,
  `mobile` varchar(11) DEFAULT NULL,
  `email` varchar(32) DEFAULT NULL,
  `question` varchar(128) DEFAULT NULL,
  `answer` varchar(128) DEFAULT NULL,
  `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `user_id` (`user_id`),
  UNIQUE KEY `mobile` (`mobile`),
  UNIQUE KEY `email` (`email`),
  CONSTRAINT `user_safe_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
 */
@Data
@Description("用户安全信息")
public class UserSafe {
    @Description("安全ID")
    private Integer id;
    @Description("用户ID")
    private Integer userId;
    @Description("手机号码")
    @RegexButNull(regex = ValidatorConsts.MOBILE, message = "手机号码格式不正确")
    private String mobile;
    @Description("电子邮箱")
    @Email(message = "电子邮箱格式不正确")
    private String email;
    @Description("安全问题")
    private String question;
    @Description("安全答案")
    private String answer;
    @Description("创建时间")
    private LocalDateTime createTime;
    @Description("更新时间")
    private LocalDateTime updateTime;
}
